<?
	$page = $page>0 ? $page : 1;
	$n = 10;
	$pages = ceil($total/$per_page);
	$start = $page - round($n/2,0);
	$start = $start>0 ? $start : 1;

	$end = $start + $n;
	$end = $end>$pages ? $pages : $end;
?>

<br clear="all" />
<ul class="pagination <?= $class ?>">
	<? if($start>1): ?>
	<li>
		<a href="<?=sprintf($link,1); ?>">1</a>
	</li>
	<li class="delimiter">&middot;&middot;&middot;</li>
	<? endif; ?>

	<? for($i=$start; $i<=$end; $i++): ?>
		<li>
			<? if($i==$page): ?>
				<strong><?= $i ?></strong>
			<? else: ?>
				<a href="<?= sprintf($link, $i); ?>"><?= $i ?></a>
			<? endif; ?>
		</li>
	<? endfor; ?>

	<? if($end<$pages): ?>
	<li class="delimiter">&middot;&middot;&middot;</li>
	<li>
		<a href="<?=sprintf($link,$pages); ?>"><?= $pages ?></a>
	</li>
	<? endif; ?>
</ul>
<br clear="all" />